using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class nutrition_answer_lineMap : EntityTypeConfiguration<nutrition_answer_line>
    {
        public nutrition_answer_lineMap()
        {
            // Primary Key
            this.HasKey(t => t.nutrition_answer_line_id);

            // Properties
            // Table & Column Mappings
            this.ToTable("nutrition_answer_line");
            this.Property(t => t.milk_amount).HasColumnName("milk_amount");
            this.Property(t => t.nutrition_answer_line_id).HasColumnName("nutrition_answer_line_id");
            this.Property(t => t.rice_amount).HasColumnName("rice_amount");
            this.Property(t => t.flour_amount).HasColumnName("flour_amount");
            this.Property(t => t.vegetable_amount).HasColumnName("vegetable_amount");
            this.Property(t => t.fruit_amount).HasColumnName("fruit_amount");
            this.Property(t => t.meat_amount).HasColumnName("meat_amount");
            this.Property(t => t.egg_amount).HasColumnName("egg_amount");
            this.Property(t => t.bean_amount).HasColumnName("bean_amount");
            this.Property(t => t.oil_amount).HasColumnName("oil_amount");
            this.Property(t => t.nut_amount).HasColumnName("nut_amount");
            this.Property(t => t.alcohol_amount).HasColumnName("alcohol_amount");
            this.Property(t => t.nutrition_answer_sheet_id).HasColumnName("nutrition_answer_sheet_id");
            this.Property(t => t.other_amount).HasColumnName("other_amount");

            // Relationships
            this.HasOptional(t => t.nutrition_answer_sheet)
                .WithMany(t => t.nutrition_answer_line)
                .HasForeignKey(d => d.nutrition_answer_sheet_id);

        }
    }
}
